3.8 \(\int (c+d x) \tanh ^2(e+f x) \, dx\)

Optimal. Leaf size=40 \[ -\frac{(c+d x) \tanh (e+f x)}{f}+c x+\frac{d \log (\cosh (e+f x))}{f^2}+\frac{d x^2}{2} \]

[Out]

c*x + (d*x^2)/2 + (d*Log[Cosh[e + f*x]])/f^2 - ((c + d*x)*Tanh[e + f*x])/f

________________________________________________________________________________________

Rubi [A]  time = 0.031248, antiderivative size = 40, normalized size of antiderivative = 1., number of steps used = 3, number of rules used = 2, integrand size = 14, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.143, Rules used = {3720, 3475} \[ -\frac{(c+d x) \tanh (e+f x)}{f}+c x+\frac{d \log (\cosh (e+f x))}{f^2}+\frac{d x^2}{2} \]

Antiderivative was successfully verified.

[In]

Int[(c + d*x)*Tanh[e + f*x]^2,x]

[Out]

c*x + (d*x^2)/2 + (d*Log[Cosh[e + f*x]])/f^2 - ((c + d*x)*Tanh[e + f*x])/f

Rule 3720

Int[((c_.) + (d_.)*(x_))^(m_.)*((b_.)*tan[(e_.) + (f_.)*(x_)])^(n_), x_Symbol] :> Simp[(b*(c + d*x)^m*(b*Tan[e
 + f*x])^(n - 1))/(f*(n - 1)), x] + (-Dist[(b*d*m)/(f*(n - 1)), Int[(c + d*x)^(m - 1)*(b*Tan[e + f*x])^(n - 1)
, x], x] - Dist[b^2, Int[(c + d*x)^m*(b*Tan[e + f*x])^(n - 2), x], x]) /; FreeQ[{b, c, d, e, f}, x] && GtQ[n,
1] && GtQ[m, 0]

Rule 3475

Int[tan[(c_.) + (d_.)*(x_)], x_Symbol] :> -Simp[Log[RemoveContent[Cos[c + d*x], x]]/d, x] /; FreeQ[{c, d}, x]

Rubi steps

\begin{align*} \int (c+d x) \tanh ^2(e+f x) \, dx &=-\frac{(c+d x) \tanh (e+f x)}{f}+\frac{d \int \tanh (e+f x) \, dx}{f}+\int (c+d x) \, dx\\ &=c x+\frac{d x^2}{2}+\frac{d \log (\cosh (e+f x))}{f^2}-\frac{(c+d x) \tanh (e+f x)}{f}\\ \end{align*}

Mathematica [A]  time = 0.236924, size = 77, normalized size = 1.92 \[ \frac{c \tanh ^{-1}(\tanh (e+f x))}{f}-\frac{c \tanh (e+f x)}{f}+\frac{d \log (\cosh (e+f x))}{f^2}-\frac{d x \text{sech}(e) \sinh (f x) \text{sech}(e+f x)}{f}+\frac{d x \text{sech}(e) (f x \cosh (e)-2 \sinh (e))}{2 f} \]

Antiderivative was successfully verified.

[In]

Integrate[(c + d*x)*Tanh[e + f*x]^2,x]

[Out]

(c*ArcTanh[Tanh[e + f*x]])/f + (d*Log[Cosh[e + f*x]])/f^2 + (d*x*Sech[e]*(f*x*Cosh[e] - 2*Sinh[e]))/(2*f) - (d
*x*Sech[e]*Sech[e + f*x]*Sinh[f*x])/f - (c*Tanh[e + f*x])/f

________________________________________________________________________________________

Maple [A]  time = 0.031, size = 65, normalized size = 1.6 \begin{align*}{\frac{d{x}^{2}}{2}}+cx-2\,{\frac{dx}{f}}-2\,{\frac{de}{{f}^{2}}}+2\,{\frac{dx+c}{f \left ({{\rm e}^{2\,fx+2\,e}}+1 \right ) }}+{\frac{d\ln \left ({{\rm e}^{2\,fx+2\,e}}+1 \right ) }{{f}^{2}}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((d*x+c)*tanh(f*x+e)^2,x)

[Out]

1/2*d*x^2+c*x-2*d*x/f-2*d/f^2*e+2*(d*x+c)/f/(exp(2*f*x+2*e)+1)+d/f^2*ln(exp(2*f*x+2*e)+1)

________________________________________________________________________________________

Maxima [B]  time = 1.19629, size = 171, normalized size = 4.28 \begin{align*} c{\left (x + \frac{e}{f} - \frac{2}{f{\left (e^{\left (-2 \, f x - 2 \, e\right )} + 1\right )}}\right )} - \frac{1}{2} \, d{\left (\frac{2 \, x e^{\left (2 \, f x + 2 \, e\right )}}{f e^{\left (2 \, f x + 2 \, e\right )} + f} - \frac{f x^{2} +{\left (f x^{2} e^{\left (2 \, e\right )} - 2 \, x e^{\left (2 \, e\right )}\right )} e^{\left (2 \, f x\right )}}{f e^{\left (2 \, f x + 2 \, e\right )} + f} - \frac{2 \, \log \left ({\left (e^{\left (2 \, f x + 2 \, e\right )} + 1\right )} e^{\left (-2 \, e\right )}\right )}{f^{2}}\right )} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((d*x+c)*tanh(f*x+e)^2,x, algorithm="maxima")

[Out]

c*(x + e/f - 2/(f*(e^(-2*f*x - 2*e) + 1))) - 1/2*d*(2*x*e^(2*f*x + 2*e)/(f*e^(2*f*x + 2*e) + f) - (f*x^2 + (f*
x^2*e^(2*e) - 2*x*e^(2*e))*e^(2*f*x))/(f*e^(2*f*x + 2*e) + f) - 2*log((e^(2*f*x + 2*e) + 1)*e^(-2*e))/f^2)

________________________________________________________________________________________

Fricas [B]  time = 1.6038, size = 578, normalized size = 14.45 \begin{align*} \frac{d f^{2} x^{2} + 2 \, c f^{2} x +{\left (d f^{2} x^{2} + 2 \,{\left (c f^{2} - 2 \, d f\right )} x\right )} \cosh \left (f x + e\right )^{2} + 2 \,{\left (d f^{2} x^{2} + 2 \,{\left (c f^{2} - 2 \, d f\right )} x\right )} \cosh \left (f x + e\right ) \sinh \left (f x + e\right ) +{\left (d f^{2} x^{2} + 2 \,{\left (c f^{2} - 2 \, d f\right )} x\right )} \sinh \left (f x + e\right )^{2} + 4 \, c f + 2 \,{\left (d \cosh \left (f x + e\right )^{2} + 2 \, d \cosh \left (f x + e\right ) \sinh \left (f x + e\right ) + d \sinh \left (f x + e\right )^{2} + d\right )} \log \left (\frac{2 \, \cosh \left (f x + e\right )}{\cosh \left (f x + e\right ) - \sinh \left (f x + e\right )}\right )}{2 \,{\left (f^{2} \cosh \left (f x + e\right )^{2} + 2 \, f^{2} \cosh \left (f x + e\right ) \sinh \left (f x + e\right ) + f^{2} \sinh \left (f x + e\right )^{2} + f^{2}\right )}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((d*x+c)*tanh(f*x+e)^2,x, algorithm="fricas")

[Out]

1/2*(d*f^2*x^2 + 2*c*f^2*x + (d*f^2*x^2 + 2*(c*f^2 - 2*d*f)*x)*cosh(f*x + e)^2 + 2*(d*f^2*x^2 + 2*(c*f^2 - 2*d
*f)*x)*cosh(f*x + e)*sinh(f*x + e) + (d*f^2*x^2 + 2*(c*f^2 - 2*d*f)*x)*sinh(f*x + e)^2 + 4*c*f + 2*(d*cosh(f*x
 + e)^2 + 2*d*cosh(f*x + e)*sinh(f*x + e) + d*sinh(f*x + e)^2 + d)*log(2*cosh(f*x + e)/(cosh(f*x + e) - sinh(f
*x + e))))/(f^2*cosh(f*x + e)^2 + 2*f^2*cosh(f*x + e)*sinh(f*x + e) + f^2*sinh(f*x + e)^2 + f^2)

________________________________________________________________________________________

Sympy [A]  time = 0.307424, size = 66, normalized size = 1.65 \begin{align*} \begin{cases} c x - \frac{c \tanh{\left (e + f x \right )}}{f} + \frac{d x^{2}}{2} - \frac{d x \tanh{\left (e + f x \right )}}{f} + \frac{d x}{f} - \frac{d \log{\left (\tanh{\left (e + f x \right )} + 1 \right )}}{f^{2}} & \text{for}\: f \neq 0 \\\left (c x + \frac{d x^{2}}{2}\right ) \tanh ^{2}{\left (e \right )} & \text{otherwise} \end{cases} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((d*x+c)*tanh(f*x+e)**2,x)

[Out]

Piecewise((c*x - c*tanh(e + f*x)/f + d*x**2/2 - d*x*tanh(e + f*x)/f + d*x/f - d*log(tanh(e + f*x) + 1)/f**2, N
e(f, 0)), ((c*x + d*x**2/2)*tanh(e)**2, True))

________________________________________________________________________________________

Giac [B]  time = 1.3522, size = 181, normalized size = 4.52 \begin{align*} \frac{d f^{2} x^{2} e^{\left (2 \, f x + 2 \, e\right )} + d f^{2} x^{2} + 2 \, c f^{2} x e^{\left (2 \, f x + 2 \, e\right )} + 2 \, c f^{2} x - 4 \, d f x e^{\left (2 \, f x + 2 \, e\right )} + 2 \, d e^{\left (2 \, f x + 2 \, e\right )} \log \left (e^{\left (2 \, f x + 2 \, e\right )} + 1\right ) + 4 \, c f + 2 \, d \log \left (e^{\left (2 \, f x + 2 \, e\right )} + 1\right )}{2 \,{\left (f^{2} e^{\left (2 \, f x + 2 \, e\right )} + f^{2}\right )}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((d*x+c)*tanh(f*x+e)^2,x, algorithm="giac")

[Out]

1/2*(d*f^2*x^2*e^(2*f*x + 2*e) + d*f^2*x^2 + 2*c*f^2*x*e^(2*f*x + 2*e) + 2*c*f^2*x - 4*d*f*x*e^(2*f*x + 2*e) +
 2*d*e^(2*f*x + 2*e)*log(e^(2*f*x + 2*e) + 1) + 4*c*f + 2*d*log(e^(2*f*x + 2*e) + 1))/(f^2*e^(2*f*x + 2*e) + f
^2)